package com.zhyl.demo.service.impl;


import com.zhyl.demo.entity.SendMessage;
import com.zhyl.demo.mapper.SendMessageMapper;
import com.zhyl.demo.service.SendMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

/**
 * @author yang3
 */
@Service
 public class SendMessageServiceImpl implements SendMessageService {
    private final SendMessageMapper sendMessageMapper;
    @Autowired
    private SendMessageServiceImpl(SendMessageMapper sendMessageMapper)
    {
        this.sendMessageMapper = sendMessageMapper;
    }

    @Override
    public Boolean sendMessage(SendMessage sendMessage) {
        Integer integer = sendMessageMapper.sendMessage(sendMessage);
        if (integer>0){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public ArrayList<SendMessage> getMsgData(int userId) {
        ArrayList<SendMessage> msgData = sendMessageMapper.getMsgData(userId);
        return msgData;
    }

    @Override
    public Boolean imRead(int id) {
        Integer i = sendMessageMapper.imRead(id);
        if (i>0){
            return true;
        }else   {
            return false;
        }
    }
}
